using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL {

/// <summary>
/// The StudentFamilyMemberRelationshipTableManager class is responsible for managing BO.StudentFamilyMemberRelationshipTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class StudentFamilyMemberRelationshipTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all StudentFamilyMemberRelationshipTable objects in the database.
/// </summary>
/// <returns>A list with all StudentFamilyMemberRelationshipTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static StudentFamilyMemberRelationshipTableList GetList(){
return StudentFamilyMemberRelationshipTableDB.GetList();
}

/// <summary>
/// Gets a single StudentFamilyMemberRelationshipTable from the database without its data.
/// </summary>
/// <param name="familyMemberAccountKey">The FamilyMemberAccountKey of the StudentFamilyMemberRelationshipTable in the database.</param>
/// <returns>A StudentFamilyMemberRelationshipTable object when the FamilyMemberAccountKey exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static StudentFamilyMemberRelationshipTable GetItem(int familyMemberAccountKey){
return GetItem(familyMemberAccountKey, false);
}

/// <summary>
/// Gets a single StudentFamilyMemberRelationshipTable from the database.
/// </summary>
/// <param name="familyMemberAccountKey">The FamilyMemberAccountKey of the StudentFamilyMemberRelationshipTable in the database.</param>
/// <param name="getStudentFamilyMemberRelationshipTableRecords">Determines whether to load all associated StudentFamilyMemberRelationshipTable records as well.</param>
/// <returns>
/// A StudentFamilyMemberRelationshipTable object when the FamilyMemberAccountKey exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static StudentFamilyMemberRelationshipTable GetItem(int familyMemberAccountKey, bool getStudentFamilyMemberRelationshipTableRecords){
StudentFamilyMemberRelationshipTable myStudentFamilyMemberRelationshipTable = StudentFamilyMemberRelationshipTableDB.GetItem(familyMemberAccountKey);
return myStudentFamilyMemberRelationshipTable;
}

/// <summary>
/// Saves a StudentFamilyMemberRelationshipTable in the database.
/// </summary>
/// <param name="myStudentFamilyMemberRelationshipTable">The StudentFamilyMemberRelationshipTable instance to save.</param>
/// <returns>The new FamilyMemberAccountKey if the StudentFamilyMemberRelationshipTable is new in the database or the existing FamilyMemberAccountKey when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static int Save(StudentFamilyMemberRelationshipTable myStudentFamilyMemberRelationshipTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
int studentFamilyMemberRelationshipTableFamilyMemberAccountKey = StudentFamilyMemberRelationshipTableDB.Save(myStudentFamilyMemberRelationshipTable);

//  Assign the StudentFamilyMemberRelationshipTable its new (or existing FamilyMemberAccountKey).
myStudentFamilyMemberRelationshipTable.FamilyMemberAccountKey = studentFamilyMemberRelationshipTableFamilyMemberAccountKey;

myTransactionScope.Complete();

return studentFamilyMemberRelationshipTableFamilyMemberAccountKey;
}
}

/// <summary>
/// Deletes a StudentFamilyMemberRelationshipTable from the database.
/// </summary>
/// <param name="myStudentFamilyMemberRelationshipTable">The StudentFamilyMemberRelationshipTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(StudentFamilyMemberRelationshipTable myStudentFamilyMemberRelationshipTable){
return StudentFamilyMemberRelationshipTableDB.Delete(myStudentFamilyMemberRelationshipTable.FamilyMemberAccountKey);
}

#endregion

}

}
